/*******************************************************************************
 * Copyright 2011 @ Kapil Viren Ahuja
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/
package com.kapil.framework.reader;

import java.util.List;
import java.util.Locale;

/**
 * Base class providing some basic functionalities for reading messages from data sources. This class provides:
 * <ul>
 * <li>A List of {@link String} to store the names of the various data sources from which the messages are to be read.
 * This is known as the DataSource</li>
 * <li>Basic implementation for reading messages, delegating calls to concrete implementations.</li>
 * </ul>
 */
public abstract class MessageReader implements IMessageReader
{

    /** The data sources from which the key is to read. */
    private transient List<String> dataSources;

    protected List<String> getDataSources()
    {
        return dataSources;
    }

    /**
     * Only constructor in the class.
     * 
     * @param dataSources - an {@link java.util.ArrayList} collection of Strings containing names of resource bundles
     */
    public MessageReader(List<String> dataSources)
    {
        this.dataSources = dataSources;
    }

    
    /**
     * @see IMessageReader#getMessage(java.lang.String)
     */
    public abstract String getMessage(String key);

    /**
     * @see IMessageReader#getMessage(java.lang.String, java.util.Locale)
     */
    public abstract String getMessage(String key, Locale locale);
}
